package com.ytjj.qmyx.mall.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.mall.model.request.DynamicTopicRequest;
import com.ytjj.qmyx.mall.service.DynamicTopicService;
import com.ytjj.qmyx.users.client.AdminClient;
import com.ytjj.qmyx.users.model.HomeImageResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 
 * @description:测评话题
 */
@Slf4j
@RestController
@RequestMapping("/dynamicTopicController")
public class DynamicTopicController {


    @Autowired
    private DynamicTopicService dynamicTopicService;

    @Autowired
    private AdminClient adminClient;

    /**
    * 获得话题排行列表
    * @returns: com.ytjj.common.api.CommonResult
    * 
    */
    @GetMapping("/getTopsDynamicTopics")
    public CommonResult getTopsDynamicTopics(){
        return  CommonResult.success(dynamicTopicService.getDynamicByIds());
    }


    /**
    * 根据话题获得测评列表
    * @returns: com.ytjj.common.api.CommonResult
    * 
    */
    @PostMapping("/getDynamicsByTopic")
    public CommonResult getDynamicsByTopic(@RequestBody DynamicTopicRequest dynamicTopicRequest){
        return  CommonResult.success(dynamicTopicService.getDynamicsByTopic(dynamicTopicRequest));
    }

    /**
     * 根据话题Id获得话题信息
     * @returns: com.ytjj.common.api.CommonResult
     * 
     */
    @GetMapping("/getTopicInfoAndPvInfoById")
    public CommonResult getTopicInfoAndPvInfoById(Integer topicId){
        return  CommonResult.success(dynamicTopicService.getTopicInfoPvById(topicId));
    }

}
